<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="now" value="<%=new java.util.Date()%>" />
<div class="contents">
    <h2>Update Information</h2>
    <div class="update_profile">
        <form name="form" action="/JudiBlog/updateprofile" method="Post">
            <div id="errorBox"></div>
            <div id="username">
                <label >User name</label>
                <input type="text" name="userName" value="${currentUser.getUserName()}"  placeholder="User Name" class="input_username" disabled/>
            </div>
            <div class="fullname">
                <label >Full name</label>
                <input type="text" name="fullName" value="${currentUser.getFullName()}" placeholder="Full Name"  class="input_name"/>
            </div>
            <!--birthday details start-->
            <div id="birthday">
                <label >Birthday</label>
                <div>
                    <select class="day" name="birthday_day" >
                        <option value="${currentUser.getBirthday().getDate()}" selected>${currentUser.getBirthday().getDate()}</option>
                        <c:forEach var="i" begin="1" end="31" step="1">
                            <option value="${i}">${i}</option>
                        </c:forEach>
                    </select>
                    &nbsp;
                    <select class="month" name="birthday_month" >
                        <option value="${currentUser.getBirthday().getMonth()+1}" selected>${currentUser.getBirthday().getMonth()+1}</option>
                        <c:forEach var="i" begin="1" end="12" step="1">
                            <option value="${i}">${i}</option>
                        </c:forEach>
                    </select>
                    &nbsp;
                    <select class="year" name="birthday_year">
                        <option value="${currentUser.getBirthday().getYear()+1900}" selected>${currentUser.getBirthday().getYear()+1900}</option>
                        <%@page import="java.util.Calendar"%>
                        <%@page import="java.util.GregorianCalendar"%>
                        <%
                            GregorianCalendar cal = new GregorianCalendar();
                            int year = cal.get(Calendar.YEAR);
                            for (int i = year; i >= year - 110; i--) {
                                out.print("<option value='" + i + "'>" + i + "</option>");
                            }
                        %>
                    </select>
                </div>
            </div>
            <!--birthday details ends-->
            <div id="radio_button">
                <label >Gender</label>
                <div>
                    <c:if test="${currentUser.isGender()}">
                        <input type="radio" name="gender" value="male" checked/>
                        <label class="gender">Male</label>
                        <input type="radio" name="gender" value="female"/>
                        <label class="gender">Female</label>
                    </c:if>
                    <c:if test="${!currentUser.isGender()}">
                        <input type="radio" name="gender" value="male"/>
                        <label class="gender">Male</label>
                        <input type="radio" name="gender" value="female" checked/>
                        <label class="gender">Female</label>
                    </c:if>
                </div>
            </div>
            <div id="idcard">
                <label >ID Card</label>
                <input type="text" name="idCard" value="${currentUser.getIdCard()}" placeholder="Your ID Card" class="input_idcard"/>
            </div>
            <div id="address">
                <label >Address</label>
                <input type="text" name="address" value="${currentUser.getAddress()}" placeholder="Your Address" class="input_adress"/>
            </div>
            <div id="email">
                <label >Email</label>
                <input type="text" name="email" value="${currentUser.getEmail()}" placeholder="Your Email" class="input_email"/>
            </div>
            <div id="phone">
                <label >Phone</label>
                <input type="text" name="phone" value="${currentUser.getPhone()}" placeholder="Your Phone" class="input_phone"/>
            </div>
            <div id="submit">
                <input type="submit" value="Update Info" name="action" class="input_submit"/>
                <input type="reset" value="Reset" class="input_submit"/>
            </div>
        </form>
    </div>
</div>